import Fields from 'dependencies/Fields'
import Field from 'dependencies/Field'
import DetailImgs  from 'modules/component/DataView/DetailImgs'
import { UniImageUpload } from 'modules/component/upload'
import priceConfig from 'pages/ai-tool/components/priceConfig'


export const tool_id = new Field({
  prop: 'tool_id',
  label: '工具ID',
  required: true
})
export const tool_name = new Field({
  prop: 'tool_name',
  label: '工具名称',
  required: true
})

export const tool_desc = new Field({
  prop: 'tool_desc',
  label: '工具简介',
  placeholder: '工具简介，英文分号可以在前端换行',
  required: true
})

export const is_online = new Field({
  prop: 'is_online',
  label: '是否上线生产',
  required: true,
  type: 'radio',
  enums: [
    { value: 1, label:"是"},
    { value: 0, label:"否"}
  ]
})
export const tool_icon = new Field({
  prop: 'tool_icon',
  label: '图标'
})
export const path = new Field({
  prop: 'path',
  label: '工具url'
})

export const price_config = new Field({
  prop: 'price_config',
  label: '价格配置'
})

export const tableFields = Object.freeze([
  tool_id,
  tool_name,
  tool_desc,
  is_online,
  tool_icon.setListComponent(DetailImgs),
  path,
  price_config
])

export const queryListFields = [
  tool_id
]
export const columns = [{
    key: "tool_id",
    title: "tool_id",
    type: "text"
  },
  {
      key: "is_online",
      title: "is_online",
      type: "text"
  }
]
export const toolCreateFields = new Fields([
  tool_id,
  tool_name,
  tool_desc,
  is_online,
  tool_icon.setEditComponent(UniImageUpload),
  path,
  price_config.setEditComponent(priceConfig)
])